package com.alibaba.service.impl;

import com.alibaba.entity.User;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: zhuangzhiwen
 * @Date: 2021/8/21
 */
@Component
public class UserService implements InitializingBean {
    private User user;

//    public UserService(){
//        System.out.println("无参数构造方法");
//    }


//    @Autowired
//    public UserService(User user) {
//        this.user = user;
//        System.out.println("一个有参数构造方法");
//    }
//
//    @Autowired
//    public UserService(User user,User user1) {
//        this.user = user;
//        System.out.println("2个有参数构造方法");
//    }


    public UserService(){
        System.out.println("无参数");
    }

    @Autowired
    public void setUser(User user){
        System.out.println("set注入");
        this.user=user;
    }

    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化");
    }
}
